<script>
import request from "../../../utils/request";
import { getShowImage } from "../../../utils";

export default {
  name: "index",
  methods: {
    getShowImage,
    //点击了图片
    imageClick(item) {
      if (item.linkUrl) {
        uni.navigateTo({
          url: `/pages/webview/index?linkUrl=${item.linkUrl}`,
        });
      }
    },
  },
  data() {
    return {
      list: [],
    };
  },
  onLoad() {
    //获取互助交流列表
    request({
      url: "mutualAc/listConfig",
      data: {
        current: 1,
        size: -1,
      },
      showLoading: true,
      errorHandle: true,
    }).then((data) => {
      this.list = data.records;
    });
  },
};
</script>

<template>
  <view class="page">
    <image
      class="image"
      v-for="item in list"
      :key="item.id"
      :src="getShowImage(item.posterPicture)"
      mode="widthFix"
      :show-menu-by-longpress="true"
      @click="imageClick(item)"
    ></image>
  </view>
</template>

<style scoped lang="scss">
.page {
  .image {
    width: 100%;
  }
}
</style>
